﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using spbtzb;

public partial class UserControls_Search : System.Web.UI.UserControl
{
    private String StrConn = ConString.ConnString;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Ddl_Types_BindData();
        }
    }

    private void Ddl_Types_BindData()
    {
        // generate datatable                       
        string sqlCmd = "SELECT * FROM ContentType WHERE ParentType = 'NO'";
        System.Data.DataTable dtTypes = AccessHelper.ExecuteDataTable(StrConn, System.Data.CommandType.Text, sqlCmd);
        if (dtTypes == null || dtTypes.Rows.Count == 0)
        {
            // 没有相应类型的信息
            // RegisterClientScriptBlock("tip", "<script>alert('没有相应的类型数据！');</script>");
            return;
        }
        this.ddl_Types.DataSource = dtTypes;
        this.ddl_Types.DataBind();
        this.ddl_Types.Items.Add(new ListItem("全部", "all"));
    }

}
